<%--
  Created by IntelliJ IDEA.
  User: 渣全蛋
  Date: 2022/3/16
  Time: 16:23
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>角色管理</title>
    <script src="https://cdn.jsdelivr.net/npm/jquery@1.12.4/dist/jquery.min.js"
            integrity="sha384-nvAa0+6Qg9clwYCGGPpDQLVpLNn0fRaROjHqs13t4Ggj3Ez50XnGQqc/r8MhnRDZ"
            crossorigin="anonymous"></script>
    <!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css"
          integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" crossorigin="anonymous">
    <!-- 可选的 Bootstrap 主题文件（一般不用引入） -->
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap-theme.min.css"
          integrity="sha384-6pzBo3FDv/PJ8r2KRkGHifhEocL+1X2rVCTTkUfGk7/0pbek5mMa1upzvWbrUbOZ" crossorigin="anonymous">
    <!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"
            integrity="sha384-aJ21OjlMXNL5UyIl/XNwTMqvzeRMZH2w8c5cRVpzpU8Y5bApTppSuUkhZXN0VxHd"
            crossorigin="anonymous"></script>
</head>
<body>
<nav class="navbar navbar-inverse navbar-fixed-top">
    <div class="container">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="http://localhost:8080/unnamed/admingl2/htglxt/1.jsp#">后台管理系统首页</a>
        </div>
        <div id="navbar" class="navbar-collapse collapse">
            <ul class="nav navbar-nav">
                <li class="dropdown">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">系统管理 <span class="caret"></span></a>
                    <ul class="dropdown-menu">
                        <li><a href="http://localhost:8080/online_video/admin/htglxt/2.jsp#">管理员管理</a></li>
                        <li><a href="http://localhost:8080/online_video/admin/htglxt/3.jsp#">用户管理</a></li>
                        <li><a href="http://localhost:8080/online_video/admin/htglxt/4.jsp#">角色管理</a></li>
                        <li><a href="http://localhost:8080/online_video/admin/htglxt/5.jsp#">分类管理</a></li>
                        <li><a href="http://localhost:8080/online_video/admin/htglxt/6.jsp#">权限管理</a></li>
                        <li><a href="http://localhost:8080/online_video/admin/htglxt/7.jsp#">日志管理</a></li>
                    </ul>
                </li>
            </ul>
            <div id="navbar" class="navbar-collapse collapse">
                <ul class="nav navbar-nav">
                    <li class="dropdown">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">工作管理 <span class="caret"></span></a>
                        <ul class="dropdown-menu">
                            <li><a href="http://localhost:8080/unnamed/admin/gzgl/8.jsp">视频管理</a></li>
                            <li><a href="http://localhost:8080/unnamed/admin/gzgl/9.jsp">订单管理</a></li>
                            <li><a href="http://localhost:8080/unnamed/admin/gzgl/11.jsp">轮播图管理</a></li>
                            <li><a href="http://localhost:8080/unnamed/admin/gzgl/10.jsp#">友情链接管理</a></li>
                        </ul>
                    </li>
                </ul>
                <div id="navbar" class="navbar-collapse collapse">
                    <ul class="nav navbar-nav navbar-right">
                        <li><a href="#">设置</a></li>
                        <li><a href="#">退出</a></li>
                    </ul>
                    <form class="navbar-form navbar-right">
                        <input type="text" class="form-control" placeholder="搜索">
                    </form>
                </div>
            </div><!--/.nav-collapse -->
        </div><!--/.nav-collapse -->
</nav><br><br><br>
<h2 class="sub-header">角色管理</h2>
<div class="table-responsive">
    <table class="table table-striped">
        <thead>
        <tr>
            <th>编号</th>
            <th>角色姓名</th>
            <th>角色描述</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        <tr>
            <td>1</td>
            <td>Lorem</td>
            <td>Lorem</td>
            <td>
                <button class="btn btn-info" data-toggle="modal" data-target="#productModal">修改</button>
                <button class="btn btn-danger">删除</button>
            </td>
        </tr>
        <tr>
            <td>2</td>
            <td>amet</td>
            <td>amet</td>
            <td>
                <button class="btn btn-info" data-toggle="modal" data-target="#productModal">修改</button>
                <button class="btn btn-danger">删除</button>
            </td>
        </tr>
        <tr>
            <td>3</td>
            <td>Integer</td>
            <td>Integer</td>
            <td>
                <button class="btn btn-info" data-toggle="modal" data-target="#productModal">修改</button>
                <button class="btn btn-danger">删除</button>
            </td>
        </tr>
        <tr>
            <td>4</td>
            <td>libero</td>
            <td>Integer</td>
            <td>
                <button class="btn btn-info" data-toggle="modal" data-target="#productModal">修改</button>
                <button class="btn btn-danger">删除</button>
            </td>
        </tr>
        <tr>
            <td>5</td>
            <td>dapibus</td>
            <td>Integer</td>
            <td>
                <button class="btn btn-info" data-toggle="modal" data-target="#productModal">修改</button>
                <button class="btn btn-danger">删除</button>
            </td>
        </tr>
        <tr>
            <td>6</td>
            <td>Nulla</td>
            <td>Integer</td>
            <td>
                <button class="btn btn-info" data-toggle="modal" data-target="#productModal">修改</button>
                <button class="btn btn-danger">删除</button>
            </td>
        </tr>
        <tr>
            <td>7</td>
            <td>nibh</td>
            <td>Integer</td>
            <td>
                <button class="btn btn-info" data-toggle="modal" data-target="#productModal">修改</button>
                <button class="btn btn-danger">删除</button>
            </td>
        </tr>
        <tr>
            <td>8</td>
            <td>sagittis</td>
            <td>Integer</td>
            <td>
                <button class="btn btn-info" data-toggle="modal" data-target="#productModal">修改</button>
                <button class="btn btn-danger">删除</button>
            </td>
        </tr>
        <tr>
            <td>9</td>
            <td>Fusce</td>
            <td>Integer</td>
            <td>
                <button class="btn btn-info" data-toggle="modal" data-target="#productModal">修改</button>
                <button class="btn btn-danger">删除</button>
            </td>
        </tr>
        <tr>
            <td>10</td>
            <td>augue</td>
            <td>Integer</td>
            <td>
                <button class="btn btn-info" data-toggle="modal" data-target="#productModal">修改</button>
                <button class="btn btn-danger">删除</button>
            </td>
        </tr>

        </tbody>
    </table>
</div>
<script src="https://cdn.jsdelivr.net/npm/jquery@1.12.4/dist/jquery.min.js"
        integrity="sha384-nvAa0+6Qg9clwYCGGPpDQLVpLNn0fRaROjHqs13t4Ggj3Ez50XnGQqc/r8MhnRDZ"
        crossorigin="anonymous"></script>
<script>
    window.jQuery || document.write(
        '<script src="https://cdn.jsdelivr.net/npm/@bootcss/v3.bootcss.com@1.0.14/assets/js/vendor/jquery.min.js"><\/script>'
    )
</script>
<script src="https://cdn.jsdelivr.net/npm/@bootcss/v3.bootcss.com@1.0.14/dist/js/bootstrap.min.js"></script>
<!-- Just to make our placeholder images work. Don't actually copy the next line! -->
<script src="https://cdn.jsdelivr.net/npm/@bootcss/v3.bootcss.com@1.0.14/assets/js/vendor/holder.min.js"></script>
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
<script src="https://cdn.jsdelivr.net/npm/@bootcss/v3.bootcss.com@1.0.14/assets/js/ie10-viewport-bug-workaround.js"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/sweetalert/2.1.2/sweetalert.min.js" type="text/javascript"></script>

<script type="text/javascript">
    var deleteAlet = function () {
        swal({
            title:"确认删除",
            text:"是否确认删除改条记录",
            icon:"warning",
            buttons:{
                catch:{
                    text: "确认",
                    value:true,
                },
                cancel:"取消"
            }
        }).then(function (isOk) {
            console.log(isOk);
            if (isOk){
                //删除记录的方法
            }
        });
    };
    $(function () {
        $('.btn-danger').click(function () {
            deleteAlet();
        })
    })
    $('.btn-info').click(function () {
        //从表格中获取每一栏的值
        var productId = $(this).parents("tr").children("td:eq(0)").text().trim();
        var name = $(this).parents("tr").children("td:eq(1)").text().trim();
        var price = $(this).parents("tr").children("td:eq(2)").text().trim();
        var category = $(this).parents("tr").children("td:eq(3)").text().trim();
        var pNum = $(this).parents("tr").children("td:eq(4)").text().trim();
        var description = $(this).parents("tr").children("td:eq(6)").text().trim();
        //把获取到的原本的值回填到输入框
        $(':input[name="name"]').val(name);
        $(':input[name="price"]').val(price);
        $(':input[name="category"]').val(category);
        $(':input[name="pNum"]').val(pNum);
        $('textarea[name="description"]').text(description);
        //修改action=update
        $(':input[name="action"]').val('update');
        //回填商品ID
        $(':input[name="id"]').val(productId);
        //修改模态框标题
        $('#myModalLabel').text('商品修改');
    });
    })
</script>
</body>
</html>
